<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * Movie filter form base class.
 *
 * @package    phpmymovies
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 16976 2009-04-04 12:47:44Z fabien $
 */
class BaseMovieFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'name'        => new sfWidgetFormFilterInput(),
      'releasedate' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'genre'       => new sfWidgetFormFilterInput(),
      'plot'        => new sfWidgetFormFilterInput(),
      'time'        => new sfWidgetFormFilterInput(),
      'company'     => new sfWidgetFormFilterInput(),
      'poster'      => new sfWidgetFormFilterInput(),
      'medium_id'   => new sfWidgetFormPropelChoice(array('model' => 'Medium', 'add_empty' => true)),
      'site_id'     => new sfWidgetFormPropelChoice(array('model' => 'Site', 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'name'        => new sfValidatorPass(array('required' => false)),
      'releasedate' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'genre'       => new sfValidatorPass(array('required' => false)),
      'plot'        => new sfValidatorPass(array('required' => false)),
      'time'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'company'     => new sfValidatorPass(array('required' => false)),
      'poster'      => new sfValidatorPass(array('required' => false)),
      'medium_id'   => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Medium', 'column' => 'id')),
      'site_id'     => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Site', 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('movie_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Movie';
  }

  public function getFields()
  {
    return array(
      'id'          => 'Number',
      'name'        => 'Text',
      'releasedate' => 'Date',
      'genre'       => 'Text',
      'plot'        => 'Text',
      'time'        => 'Number',
      'company'     => 'Text',
      'poster'      => 'Text',
      'medium_id'   => 'ForeignKey',
      'site_id'     => 'ForeignKey',
    );
  }
}
